package com.le.tester.book.effectivejava3rdchinese.secondReading.l52;

import java.math.BigInteger;
import java.util.*;

/**
 * createTime：2024-10-12 10:12
 * description：明智慎重的使用重载，个人一点也不喜欢重载这个语法
 */
public class CollectionClassifier {
    public static String classify(Set<?> s) {
        return "Set";
    }

    public static String classify(List<?> list) {
        return "List";
    }

    public static String classify(Collection<?> collection) {
        return "Unknown Collection";
    }

    public static void main(String[] args) {
        Collection<?>[] collections = {
                new HashSet<String>(),
                new ArrayList<BigInteger>(),
                new HashMap<String, String>().values()
        };
        for (Collection<?> c : collections)
            System.out.println(classify(c));

    }
}
